# -*- coding: utf-8 -*-
"""
@author:  yinbing.li(yinbing.li@zillnk.com)
@version: 1.0.0
@file:    4. 寻找两个正序数组的中位数.py
@time:    2023/4/13 11:12
"""
import math
from typing import List


class Solution:
    def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
        merge = sorted(nums1 + nums2)
        div, mod = divmod(len(merge), 2)
        return merge[div] if mod == 1 else (merge[div] + merge[div-1]) / 2


s = Solution()
print(s.findMedianSortedArrays([1, 3], [2, 4]))
